﻿@using TestOnlineProject.Models.Entities
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    if (ViewBag.Msg != null)
    {
    <script>        alert("@ViewBag.Msg")</script>
    }
}
<div class="site_map">
    Home</div>
<br />
<div>
    @{
        <table class="table table-bordered" style="margin: 0px">
            <tr>
                <td style="width: 50%">
                    <div style="font-weight: bold" class="label label-info">
                        New Tests
                    </div>
                    <table style="width: 100%">
                        @{
                            var testList = ViewBag.Test as List<Test>;
                            if (testList.Count == 0)
                            {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                </td>
                                <td style="border: 0px">
                                    <span>Empty.</span>
                                </td>
                            </tr>
                            }
                            else
                            {
                                for (int i = 0; i < (testList.Count >= 10 ? 10 : testList.Count); i++)
                                {
                            
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                    <img src="@Url.Content("~/Images/7.gif")"/>
                                </td>
                                <td style="border: 0px">
                                    <span style="word-wrap: break-word">[@Html.ActionLink(testList[i].Subject.Code, "Index", "Test", new { subjectId = testList[i].SubjectId }, null)]
                                        @Html.ActionLink(testList[i].Title, "Details", "Test", new { id = testList[i].TestId }, null)</span>
                                    <br />
                                    <span style="font-style: italic; color: Black">By @Html.ActionLink(testList[i].User.FullName, "Index", "Account", new { userId = testList[i].UserId }, new { target = "_blank", style = "color:#f85087" })
                                        - @testList[i].CreatedTime</span>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </table>
                    <br />
                </td>
                <td>
                    <div style="font-weight: bold" class="label label-info">
                        New Sections
                    </div>
                    <table style="width: 100%">
                        @{
                            var sectionList = ViewBag.Sections as List<Section>;
                            if (sectionList.Count == 0)
                            {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                </td>
                                <td style="border: 0px">
                                    <span>Empty.</span>
                                </td>
                            </tr>
                            }
                            else
                            {
                                for (int i = 0; i < (sectionList.Count >= 10 ? 10 : sectionList.Count); i++)
                                {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                    <img src="@Url.Content("~/Images/7.gif")"/>
                                </td>
                                <td style="border: 0px">
                                    <span style="word-wrap: break-word">[@Html.ActionLink(sectionList[i].Subject.Code, "Index", "Section", new { subjectId = sectionList[i].SubjectId }, null)]
                                        @Html.ActionLink(sectionList[i].Name, "Details", "Section", new { id = sectionList[i].SectionId }, null)</span>
                                    <br />
                                    <span style="font-style: italic; color: Black">By @Html.ActionLink(sectionList[i].User.FullName, "Index", "Account", new { userId = sectionList[i].UserId }, new { target = "_blank", style = "color:#f85087" })
                                        - @sectionList[i].CreatedTime</span>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </table>
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                    <div style="font-weight: bold" class="label label-info">
                        New Questions</div>
                    <table style="width: 100%">
                        @{                
                            var questions = ViewBag.Questions as List<Question>;
                            if (questions.Count == 0)
                            {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                </td>
                                <td style="border: 0px">
                                    <span>Empty.</span>
                                </td>
                            </tr>
                            }
                            else
                            {
                                for (int i = 0; i < (questions.Count >= 10 ? 10 : questions.Count); i++)
                                { 
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                    <img src="@Url.Content("~/Images/7.gif")"/>
                                </td>
                                <td style="border: 0px">
                                    <span style="word-wrap: break-word">[@Html.ActionLink(questions[i].Subject.Code, "Index", "Question", new { subjectId = questions[i].SubjectId }, null)]
                                        @Html.ActionLink(questions[i].Title, "Details", "Question", new { id = questions[i].QuestionId }, null)</span>
                                    <br />
                                    <span style="font-style: italic; color: Black">By @Html.ActionLink(questions[i].User.FullName, "Index", "Account", new { userId = questions[i].UserId }, new { target = "_blank", style = "color:#f85087" })
                                        - @questions[i].CreatedTime</span>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </table>
                    <br />
                </td>
                <td>
                    <div style="font-weight: bold" class="label label-info">
                        New Discussions
                    </div>
                    <table style="width: 100%">
                        @{
                            var discussions = ViewBag.Discussions as List<Discussion>;
                            if (discussions.Count == 0)
                            {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                </td>
                                <td style="border: 0px">
                                    <span>Empty.</span>
                                </td>
                            </tr>
                            }
                            else
                            {
                                for (int i = 0; i < (discussions.Count >= 10 ? 10 : discussions.Count); i++)
                                {
                            <tr>
                                <td style="width: 3px; border: 0px; padding-right: 0px">
                                    <img src="@Url.Content("~/Images/7.gif")"/>
                                </td>
                                <td style="border: 0px">
                                    <span style="word-wrap: break-word">[@Html.ActionLink(discussions[i].Subject.Code, "Index", "Discussion", new { subjectId = discussions[i].SubjectId }, null)]
                                        @Html.ActionLink(discussions[i].Title, "Details", "Discussion", new { discussionId = discussions[i].DiscussionId }, null)</span>
                                    <br />
                                    <span style="font-style: italic; color: Black">By @Html.ActionLink(discussions[i].User.FullName, "Index", "Account", new { userId = discussions[i].UserId }, new { target = "_blank", style = "color:#f85087" })
                                        - @discussions[i].CreatedTime</span>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </table>
                    <br />
                </td>
            </tr>
        </table>
    }
</div>
